home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7568 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: news.rain.org!usenet
  2. From: "Guus Leeuw jr." <guusl@eiffel.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: How to generate all the combinations of n numbers?
  5. Date: Fri, 23 Feb 1996 14:32:54 -0800
  6. Organization: Interactive Software Engineering Inc. http://www.eiffel.com/
  7. Message-ID: <312E4096.9456B1A@eiffel.com>
  8. References: <4giuc9$pq@news.cis.okstate.edu>
  9. NNTP-Posting-Host: @outback.eiffel.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (X11; I; Linux 1.2.8 i586)
  14. CC: kakani@osuunx.ucc.okstate.edu
  15.  
  16. Madhav Kakani wrote:
  17. > Hello everybody,
  18. >         I am having problems in writing a c/c++ program which
  19. > generates all possible combinations of n given numbers.
  20. > For example, if an array x has some numbers
  21. > int x[] = {1,2,3};
  22. > the program should generate the following output:
  23. > 1
  24. > 2
  25. > 3
  26. > 12
  27. > 13
  28. > 23
  29. > 123
  30.  
  31. Assignment, huh?
  32.  
  33. Well, two things:
  34.  
  35. a) we don't do that. Ya gotta come up with your example code an we'll go
  36. from there (if there's any not obvious problem)
  37.  
  38. b) How did you write the above list anyways? Is there some method that
  39. has been followed? If so, try to implement that method. (I see
  40. immediately some method that you followed...)
  41.  
  42. Regards,
  43.     Guus
  44.